package com.gongj.lifecycle;

import org.springframework.context.annotation.*;
import org.springframework.scheduling.annotation.EnableAsync;

@ComponentScan(basePackages = {"com.gongj.lifecycle"})
//@EnableAsync
//@PropertySource("spring-config.xml")
//@Scope
@ImportResource
@Configuration(proxyBeanMethods = false)
//@Import(ImportSelectorTest.class)
public class AppApplication {

	@Bean
	private AppConfig appConfig(){
		return new AppConfig();
	}

	/**
	 * @Bean
	 * private AppConfig appConfig(){
	 * 		return new AppConfig();
	 * }
	 *
	 *public class AppConfig {
	 *
	 *    @Bean
	 *    UserService u(){
	 * 		UserService userService = new UserService();
	 * 		return userService;
	 *    }
	 *}
	 */

	public static void main(String[] args) {
		AnnotationConfigApplicationContext context =
				new AnnotationConfigApplicationContext();
		context.register(AppApplication.class);
		context.refresh();
		//UserService bean = context.getBean(UserService.class);
		//System.out.println("bean = " + bean);
	/*	context.start();
		context.stop();*/

	}
}
